package com.fastjars.business.spring.http.servlet;

import com.fastjars.business.spring.http.servlet.wrapper.HttpServletRequestWrapper;

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

/**
 * XssFilter
 * Xss攻击过滤
 * @author Brant Liu <br>
 * 邮箱：lbf1988@qq.com <br>
 * 日期：2018/5/4
 * @version 1.0.0
 */
public class XssFilter implements Filter {

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        // TODO: 过滤xss攻击
        HttpServletRequestWrapper xssRequestWrapper = new HttpServletRequestWrapper((HttpServletRequest)request);
        // TODO: 请求转发
        chain.doFilter(xssRequestWrapper,response);
    }

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
    }

    @Override
    public void destroy() {
    }
}
